<!--
/**************************************************/
/* Programmer: Scott Gildersleeve                 */
/*       Date: 2/14/2013                          */
/*  Page Name: GradeBook.php                      */
/*                                                */
/**************************************************/

/**************************************************/
/* Universal gradebook for students and teachers. */
/*                                                */
/**************************************************/

/**************************************************/
/*   Date        Reviser       Revision           */
/* --------     ---------     ----------          */
/*                                                */
/*                       	                      */ 
/*							                      */
/*							                      */
/*                                                */
/**************************************************/
-->
<link rel="stylesheet" type="text/css" href="css/template.css" />
<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.10.0.custom.css" />
<link rel="stylesheet" type="text/css" href="css/gradebook.css" />
<link rel="stylesheet" type="text/css" href="DataTables/media/css/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="DataTables/media/css/TableTools_JUI.css" />
<script type="text/javascript" src="JQuery/jquery-1.9.0.min.js"></script>  
<script type="text/javascript" src="JQuery/jquery-ui-1.10.0.custom.js"></script>
<script type="text/javascript" charset="utf-8" src="DataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
	$(function() {
        $("#tabs").tabs();
 	    $(document).ready( function () {
            $('.table_class').dataTable({
	            "bJQueryUI": true
            });
	    });
    });
</script>
<?php
require_once('webservices.php');
require_once('functions.php');
require_once('session_handler.php');

function gradebook_main()
{
	session_handler_start();

	$user_id        = $_SESSION['userid'];
	$studentsArray = Get_student_book($user_id);

	// Loop Controling Gradebook per Student
		echo '<table id="table_id" class="display table_class">';
	    $Columns = array();
	    if(count($studentsArray) != 0)
		{
			foreach($studentsArray[0] as $Column=>$value2)
			{		
				array_push($Columns, $Column);
			}
			echo '<thead>';
			   echo '<tr>';
			foreach($Columns as $Col)
			{
				echo '<th>'.$Col.'</th>';
			}
				   
				echo '</tr>';
			echo '</thead>';
			echo '<tbody>';
			
			foreach ($studentsArray as $attribute=>$values)
			{
				echo '<tr>';
					foreach($values as $value3)
					{
						echo '<td>' . $value3 . '</td>';
					}
				echo '</tr>';
			}
			
			echo '</tbody>';
			}
		else
		{
		   echo '<thead>';
		      echo '<th></th>';
		   echo '<thead>';
		   echo '<tbody>';
		   echo '</tbody>';
		}
		echo '</table>';
		echo '</div>';
}

if (!debug_backtrace())
{
	gradebook_main();
}
?>